|
900612 ESP -- SURF Center : Extracting Image Point Features
This page last changed on May 21, 2012 by brian.
Extracting Spots from ESP ImagesThe spots extracted from the image are used to calculate the fitness of the match between the GAL file and image file. The Short VersionThe first step is to read the raw tiff image: import java.io.File import java.net.URL import org.mbari.esp.ia.services.ToolBox // READ ESP TIFF IMAGE val io = ToolBox.imageIOService val image = io.read(new URL("file:/test08/pcr11jun2520h2000ml40s.tif")).getProcessor // WRITE AS PNG io.write(image, new File("pcr11jun2520h2000ml40s.png"))
There is a small function call that extracts the image spots. import org.mbari.esp.ia.imglib.MultiPassRegionsExtractorFn
val regions = MultiPassRegionsExtractorFn(image)
val points = regions.map(_.centroid).toSeq
The above code snippet does the following:
We can draw the extracted points onto the image using this bit of code: import java.io.File import java.awt.{Color, Graphics2D} import java.awt.geom.{Ellipse2D} import java.awt.image.BufferedImage import org.mbari.esp.ia.imglib.ToRGBFn val colorImage = ToRGBFn(image).getBufferedImage val g2 = colorImage.getGraphics.asInstanceOf[Graphics2D] val circles = points.map(p => new Ellipse2D.Double(p.x - 2, p.y - 2, 4, 4)) g2.setPaint(Color.GREEN) circles.foreach(g2.draw(_)) io.write(colorImage, new File("pcr11jun2520h2000ml40ss-with-extracted-spots.png")) g2.dispose()
Under the HoodIn order to extract the regions that represent the spots we threshold at multiple levels using 2 different image treatments. The 2 image treatments are:
We calculate a base threshold for each treatment using maximum entropy. Then we make multiple passes across the image from using the following: val bound = 25 // Add and subtract this from threshold to get range val minVal = if (split - bound < 0) split else split - bound val maxVal = if (split + bound > 255) split else split + bound for (i <- minVal to maxVal by 5) { // Process image. ie. apply threshold and floodfill } For each pass across an image, we aggregate all the regions into a collection. During the aggregations we eliminate spurious or duplicate regions by:
Extracting Image Point Features 2 |
| Document generated by Confluence on Feb 03, 2026 14:16 |